package com.sopra.tecnica.poc.server.dao;

import org.springframework.stereotype.Repository;

import com.sopra.tecnica.poc.server.entity.SizeEntity;

@Repository
public class SizeDao extends ADao<SizeEntity> {

	@Override
	protected Class<SizeEntity> getManagedClass() {
		return SizeEntity.class;
	}

	public void update(Integer orderNum, Integer lineNum, Integer sizeId, Integer qty,
			Integer discount, Integer netPrice) {
		getJdbcTemplate().update(
				"UPDATE " + getTable()
				+ " SET qtecde = ?, remise = ?, prixnet = ?"
				+ " WHERE societe = '001'"
				+ " AND noccde = ?"
				+ " AND noclig = ?"
				+ " AND itaille = ?",
		        qty, discount, netPrice, orderNum, lineNum, sizeId);
		
		System.out.format("UPDATE " + getTable()
				+ " SET qtecde = %s, remise = %s, prixnet = %s"
				+ " WHERE societe = '001'"
				+ " AND noccde = %s"
				+ " AND noclig = %s"
				+ " AND itaille = %s%n",
				qty, discount, netPrice, orderNum, lineNum, sizeId);
	}
}
